import java.util.Scanner;
interface Fruit {
    public abstract String eat();
}
class Apple implements Fruit {
    private String name;
    public Apple() {
        name = "Apple";
    }
    @Override
    public String eat() {
        return "吃"+name;
    }
}
class Orange implements Fruit {
    private String name;
    public Orange() {
        name = "Orange";
    }
    @Override
    public String eat() {
        return "吃"+name;
    }
}
class Factory {
    public static Fruit getName(String name) {
        if("Apple".equalsIgnoreCase(name))
            return new Apple();
        else if("Orange".equalsIgnoreCase(name))
            return new Orange();
        else
            return null;
    }
}

public class Test_1 {
    public static void main(String[] args) {

        // TODO Auto-generated method stub
        String name;
        System.out.println("你想吃什么水果？->");
        Scanner scan=new Scanner(System.in);
        name=scan.next();
        Fruit F=Factory.getName(name);
        if(F==null)
            System.out.println("没有这种水果");
        else
            System.out.println(F.eat());
    }
}
